<!DOCTYPE html>
<html lang="en">
	<head>
		<title> New Document </title>
		<meta charset="utf-8">
		<meta name="Author" content="">
		<meta name="Keywords" content="">
		<meta name="Description" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<!-- Bootstrap -->
		<link href="${webRoot}resources/css/bootstrap.min.css" rel="stylesheet" media="screen">
		<link href="${webRoot}resources/css/style.css" rel="stylesheet">
	</head>
<body class="main">
	<div class="wrap">
		<form class="form-horizontal" method="post"
			action="${webRoot}user/addUserLevelInfo.do" id="levelInfo">
		  <div class="control-group">
		   <ul class="breadcrumb">
		    <li><span id="test">您当前的位置：</span><a href="#">首页</a> <span class="divider">>></span></li>
		    <li class="active">${addLevel}</li>
	     </ul>
		  </div>
		  <div class="control-group" id="labelId">
		    <label class="control-label" for="rolename">级别</label>
		    <div class="controls">
				<input type="text" id="rolename" name="rolename">
		    </div>
		  </div>	
		  <div class="control-group">
		    <label class="control-label" for="rscore">满分</label>
		    <div class="controls">
		      <input type="text" id="rscore" name="rscore">
		    </div>
		  </div>
		   <div class="control-group">
				<label class="control-label" for="iscon">首页投稿权</label>
				<div class="controls">
					<select id="iscon" name="iscon">
						<option value="">请选择</option>
						<option value="Y">是</option>
						<option value="N">否</option>
					</select>
				</div>
			</div>  
			<div class="control-group">
				<label class="control-label" for="isaud">内容审核权</label>
				<div class="controls">
					<select id="isaud" name="isaud">
						<option value="">请选择</option>
						<option value="Y">是</option>
						<option value="N">否</option>
					</select>
				</div>
			</div>  
			<div class="control-group">
				<label class="control-label" for="group_id">所属组</label>
				<div class="controls">
					<select id="group_id" name="group_id">
						<option value="">请选择</option>
						<#list listGroup as groupEntity>
							<option value="${groupEntity.id}">${groupEntity.groupname}</option>
						</#list>
					</select>
				</div>
			</div> 
			<div class="control-group">
		    <label class="control-label" for="nupscore">内部加分权限</label>
		    <div class="controls">
		      <input type="text" id="nupscore" name="nupscore">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="ndownscore">内部减分权限</label>
		    <div class="controls">
		      <input type="text" id="ndownscore" name="ndownscore">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="wupscore">外部加分权限</label>
		    <div class="controls">
		      <input type="text" id="wupscore" name="wupscore">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="wdownscore">外部减分权限</label>
		    <div class="controls">
		      <input type="text" id="wdownscore" name="wdownscore">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="timelimit">时限</label>
		    <div class="controls">
		      <input type="text" id="timelimit" name="timelimit">
		    </div>
		  </div>
		  <div class="control-group">
		    <div class="controls">
		      <button type="button" class="btn" id="insertTo" onclick="sendValue();">确定添加</button>
		    </div>
		  </div>
		</form>		
	</div>			
	<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
	<script src="${webRoot}resources/js/bootstrap.min.js"></script>
	<script src="${webRoot}resources/js/js.js"></script>
	<script type="text/javascript">
		function sendValue(){
			var rolename =$("#rolename").val();
			var rscore =$("#rscore").val();
			var iscon =$("#iscon").val();
			var isaud =$("#isaud").val();
			var group_id =$("#group_id").val();
			
			var nupscore =$("#nupscore").val();
			var ndownscore =$("#ndownscore").val();
			var wupscore =$("#wupscore").val();
			var wdownscore =$("#wdownscore").val();
			var timelimit = $("#timelimit").val();
			if($.trim(rolename) == null ||$.trim(rolename) =="" ){
				alert("级别不能为空！");
				return ;
			}
			if($.trim(rscore) == null ||$.trim(rscore) =="" ){
				alert("满分不能为空！");
				return ;
			}
			if(isNaN(rscore)){
				alert("满分必须为数字！");
				return ;
			}
			if($.trim(iscon) == null ||$.trim(iscon) =="" ){
				alert("请选择首页投稿权！");
				return ;
			}
			if($.trim(isaud) == null ||$.trim(isaud) =="" ){
				alert("请选择内容审核权！");
				return ;
			}
			if($.trim(group_id) == null ||$.trim(group_id) =="" ){
				alert("请选择分组！");
				return ;
			}
			
			if($.trim(nupscore) == null ||$.trim(nupscore) =="" ){
				alert("内部加分权不能为空！");
				return ;
			}
			if(isNaN(nupscore)){
				alert("内部加分权必须为数字！");
				return ;
			}
			if($.trim(ndownscore) == null ||$.trim(ndownscore) =="" ){
				alert("内部减分权不能为空！");
				return ;
			}
			if(isNaN(ndownscore)){
				alert("内部减分权必须为数字！");
				return ;
			}
			if($.trim(wupscore) == null ||$.trim(wupscore) =="" ){
				alert("外部加分权不能为空！");
				return ;
			}
			if(isNaN(wupscore)){
				alert("外部加分权必须为数字！");
				return ;
			}
			if($.trim(wdownscore) == null ||$.trim(wdownscore) =="" ){
				alert("外部减分权不能为空！");
				return ;
			}
			if(isNaN(wdownscore)){
				alert("外部减分权必须为数字！");
				return ;
			}
			if($.trim(timelimit) == null ||$.trim(timelimit) =="" ){
				alert("时限不能为空！");
				return ;
			}
			if(isNaN(timelimit)){
				alert("时限必须为数字！");
				return ;
			}
			document.getElementById("levelInfo").submit();
		}
		</script>
</body>
</html>
